package com.aaa.spring.intercept;

import org.springframework.stereotype.Component;
import org.springframework.ui.ModelMap;
import org.springframework.web.context.request.WebRequest;
import org.springframework.web.context.request.WebRequestInterceptor;

/**
 * @author ：zhu
 */
@Component
public class MySecondInterceptor implements WebRequestInterceptor {
    @Override
    public void preHandle(WebRequest request) throws Exception {
        System.out.println("WebRequestInterceptor||preHandle执行了");
    }

    @Override
    public void postHandle(WebRequest request, ModelMap model) throws Exception {
        //model.addAttribute("username","xxxxx");
        System.out.println("WebRequestInterceptor||postHandle执行了");
    }

    @Override
    public void afterCompletion(WebRequest request, Exception ex) throws Exception {
        System.out.println("WebRequestInterceptor||afterCompletion执行了");
    }
}

